import {Component} from 'react'
import './index.css'
export default class Header extends Component{
    constructor(props){
        super(props)
        console.log(this.props)
    }
    addTodo = (e)=>{
        if(e.charCode == 13){
            this.props.todoAddHandle(e.target.value)
        }
    }
    render(){
        return (
            <div className="todo-header">
                <input type="text" placeholder="请输入你的任务名称，按回车键确认" onKeyPress={this.addTodo}/>
            </div>
        )
    }
}